package cn.fl.repay.utils;

import java.math.BigDecimal;

/**
 * @author: leon (pengli@58coin.com)
 * @createDate: 2020/4/30
 * @company: (C) Copyright 58BTC 2020
 * @since: JDK 1.8
 * @description:
 */
public class BigDecimalUtils {
    private static BigDecimal ratio = BigDecimal.valueOf(100);


    public static long convertYuanToFen(BigDecimal yuan){
        return yuan.multiply(ratio).longValue();
    }

    public static long convertYuanToFen(String yuan){
        BigDecimal numberYuan = BigDecimal.ZERO;
        try {
            numberYuan = new BigDecimal(yuan);
        } catch (Exception e) {
        }
        return convertYuanToFen(numberYuan);
    }
}
